package org.link.web;

import org.link.bean.IpInfo;
import org.link.bean.UserInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 
 * project_name:springlearn
 * package_name:ord.link.web
 * file_name:testController.java
 * @author Link
 * create_date:2015年11月16日 下午4:39:35
 * modified_date:
 * description: 控制器处理类
 *
 */
@Controller
public class TestController {

	@RequestMapping("/hello")
	public ModelAndView hello1(){
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.addObject("name", "link");
		modelAndView.setViewName("hello");//跳到hello.jsp界面
		return modelAndView;
	}
	
	@RequestMapping("hello1")
	public String hello(){
		return "hello1";//跳转至hello1界面
	}
	
	@RequestMapping("skip")
	public String testSkip(){//测试内部和 外部跳转
		//return "/";
		return "redirect:hello";//使用外部跳转到指定的某个方法
		//return "redirect:hello";//指明外部跳转到指定的页面
		//return "forward:/world";//使用forward指定内部跳转到某个具体方法
		//return "forward:hello1";//指明内部跳转到指定页面
	}
	
	@RequestMapping("helloUser")
	public String userInfo(UserInfo userInfo){
		System.out.println(userInfo);
		return "hello1";
	}
	@RequestMapping("ipAddress")
	public String ipAddress(){
		System.out.println();
		return "hello";
	}
}






